<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象</title>
</head>
<body>

</body>
<script>

    // 对象的创建方法
    // 1. var obj = {} plainObject 对象字面量/对象直接量
    // 2. 构造函数
    //  1) 系统自带的构造函数 new Object()
    //  2) 自定义

    // 自定义
    var mrDeng = {

        name : "MrDeng",
        age : 90,
        sex : "male",
        health : 100,
        smoke : function () {
            console.log('I am smoke ! coll !!!');
            this.health --;
        },
        drink : function () {
            console.log('I am drink');
            this.health ++;
        }

    }

    // 构造函数
    // 大驼峰命名规则
    function Car(){

        this.name = 'BMW';
        this.height = 1400;
        this.lang = 4900;
        this.weight = 1000;
        this.health = 100;
        this.run = function (){
            this.health --;
        }

    }
    var car = new Car();
    var car1 = new Car();
    car.name = 'Merz';
    car1.name = 'Maserati';

    delete mrDeng.name;
</script>
</html>
